<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use backend\helpers\IsHiddenFlagHelper;
use backend\helpers\SimpleFlagHelper;
use backend\helpers\ActionButton;

/* @var $this yii\web\View */
/* @var $model backend\models\Page */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Страницы', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container page-view">

    <h1 class="main-title"><?= Html::encode($this->title) ?></h1>

    <p>
        <?= ActionButton::update($model->id, 'updatePage') ?>
        <?= ActionButton::delete($model->id, 'Вы уверены, что хотите удалить элемент?', 'deletePage') ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'options' => ['class' => 'table table-striped detail-view'],
        'attributes' => [
            [
                'attribute'=>'is_draft',
                'value' => function ($model) {
                    return IsHiddenFlagHelper::statusLabel($model->is_draft);
                },
                'format' => 'raw'
            ],
            [
                'attribute'=>'is_hidden',
                'value' => function ($model) {
                    return SimpleFlagHelper::statusLabel($model->is_hidden);
                },
                'format' => 'raw'
            ],
            'id',
            'title',
            'alias',
            'description',
            'content:ntext',
            'path',
            'depth',
            'sort',
            'view',
        ],
    ]) ?>

</div>
